using System;
using UnityEngine;
using UnityEngine.UI;

namespace CGF
{
    //该脚本自动生成或覆盖，不可编辑
    public partial class PanelPersonalInfo
    {   
		public CButton BtnBack;
		public ScrollRect ScrollRect;
		public CButton CellNickname;
		public CButton CellPhone;
		public CButton CellEmail;
		public CButton CellWhatsApp;
		public CButton CellLoginPasswd;
		public Image LoginPasswdLine;
		public CButton CellWithdrawPasswd;
		public ImagePro List;

        public Reference reference { get; private set; }
        public Action onProsBindCompleted;
        public bool isProsBindCompleted;
        
        public void BindProperties(Transform transform)
        {   
            reference = transform.GetComponent<Reference>();
            if(!reference)return;
            int nodeIndex = 0;
			BtnBack = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			ScrollRect = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<ScrollRect>();
			CellNickname = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			CellPhone = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			CellEmail = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			CellWhatsApp = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			CellLoginPasswd = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			LoginPasswdLine = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Image>();
			CellWithdrawPasswd = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			List = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<ImagePro>();
            isProsBindCompleted = true;
            onProsBindCompleted?.Invoke();
        }
        
        public void SetProsBindCompletedAction(Action action)
        {
            if (isProsBindCompleted)
            {
                action?.Invoke();
            }
            else
            {
                onProsBindCompleted = action;
            }
        }
    }
}
